{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1cc2e12f",
   "metadata": {},
   "source": [
    "# week8作业练习"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "57a0b370",
   "metadata": {},
   "source": [
    "| 列表的方法 | Description |使用方法 | 备注 |\n",
    "| ------ | ----------- |----------- |----------- |\n",
    "| append     |  Append object to the end of the list.   |list.append(object)|\n",
    "| 增 | append/insert |append增加元素到末尾，insert增加元素到某个位置 |增加元素到指定位置的方法：names.insert(指定位置index后一位,\"元素\") |\n",
    "|删 | remove/del/pop |remove指定某个数据进行删除, del指定[x]的某个数据位置进行删除|pop不指定默认删除最后一个值,clear删除列表中的所有元素|\n",
    "|改 |reverse/sort/copy |reverse颠倒列表的顺序,sort对列表进行排序,copy返回列表的副本  |文本过于繁杂时使用可提高效率|\n",
    "|查 |if,in;len();count |检查项目是否存在；查列表的长度；查询文本出现的频数|当文本过长时，使用其方法能够方便计算 |\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "9427de43",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['lsz', 'yjw', 'hs', 'lwy']"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lists = [\"lsz\",\"yjw\",\"hs\",\"lwy\"]\n",
    "lists"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "7933c2e3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['lsz', 'yjw', 'hs', 'lwy', 'lsx']"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lists.append(\"lsx\")\n",
    "lists"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "a7b033ba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['lsz', 'yjw', '哈哈哈哈', 'hs', 'lwy', 'lsx']"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lists.insert(2,\"哈哈哈哈\")\n",
    "lists"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "94168816",
   "metadata": {},
   "outputs": [],
   "source": [
    "lists.remove(\"lsz\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "575bbf17",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['yjw', '哈哈哈哈', 'hs', 'lwy', 'lsx']"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lists"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "82268a8e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
